package dtos;

import java.util.List;



public class TransportationTypeDTO {
	
	@Override
	public String toString() {
		if (type.equals("flight")){
			return "Flight with "+company+", "+flightClass+" class";
		}
		if (type.equals("bus")){
			return "Bus with "+company+", "+vehicleType;
		}
		if (type.equals("train")){
			return "Train with "+company+", "+trainClass+" class";
		}
		return "";
	}

	private int transportationTypeID;

	private String company;

	private String flightClass;

	private String trainClass;

	private String type;

	private String vehicleType;

	private List<MeanOfTransportationDTO> meanOfTransportations;

	public TransportationTypeDTO() {
	}

	public int getTransportationTypeID() {
		return this.transportationTypeID;
	}

	public void setTransportationTypeID(int transportationTypeID) {
		this.transportationTypeID = transportationTypeID;
	}

	public String getCompany() {
		return this.company;
	}

	public void setCompany(String company) {
		this.company = company;
	}

	public String getFlightClass() {
		return this.flightClass;
	}

	public void setFlightClass(String flightClass) {
		this.flightClass = flightClass;
	}

	public String getTrainClass() {
		return this.trainClass;
	}

	public void setTrainClass(String trainClass) {
		this.trainClass = trainClass;
	}

	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getVehicleType() {
		return this.vehicleType;
	}

	public void setVehicleType(String vehicleType) {
		this.vehicleType = vehicleType;
	}

	public List<MeanOfTransportationDTO> getMeanOfTransportations() {
		return this.meanOfTransportations;
	}

	public void setMeanOfTransportations(List<MeanOfTransportationDTO> meanOfTransportations) {
		this.meanOfTransportations = meanOfTransportations;
	}

	public MeanOfTransportationDTO addMeanOfTransportation(MeanOfTransportationDTO meanOfTransportation) {
		getMeanOfTransportations().add(meanOfTransportation);
		meanOfTransportation.setTransportationType(this);

		return meanOfTransportation;
	}

	public MeanOfTransportationDTO removeMeanOfTransportation(MeanOfTransportationDTO meanOfTransportation) {
		getMeanOfTransportations().remove(meanOfTransportation);
		meanOfTransportation.setTransportationType(null);

		return meanOfTransportation;
	}
	
	public String getTransportationClass(){
		String res ="";
		if (type.equals("flight")){
			res = this.flightClass;
		}
		else{
			if (type.equals("bus")){
				res = this.vehicleType;
			}
			else{
				res= this.trainClass;
			}
		}
		return res;
	}


}
